<template>
  <div class="im-fq-topInputBox">
    <div>
      <el-button size="mini" type="primary" @click="handleQuery"
        >查询</el-button
      >
    </div>
    <div class="im-fq-topInput">
      <ul>
        <li>
          <el-input
            size="mini"
            v-model="workbinCode"
            placeholder="请输入内容"
          ></el-input>
          <span>缓存箱编号：</span>
        </li>
        <li>
          <el-input
            size="mini"
            v-model="mProductNumber"
            placeholder="请输入内容"
          ></el-input>
          <span>成品型号：</span>
        </li>
        <li>
          <el-input
            size="mini"
            v-model="barcode"
            placeholder="请输入内容"
          ></el-input>
          <span>条码：</span>
        </li>
        <li>
          <el-input
            size="mini"
            v-model="itemCode"
            placeholder="请输入内容"
          ></el-input>
          <span>图号：</span>
        </li>
        <li>
          <el-input
            size="mini"
            v-model="qualityCode"
            placeholder="请输入内容"
          ></el-input>
          <span>质量编号：</span>
        </li>
        <li>
          <el-input
            size="mini"
            v-model="aoCode"
            placeholder="请输入内容"
          ></el-input>
          <span>AO号：</span>
        </li>
        <li>
          <el-date-picker
            v-model="startDate"
            size="mini"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="开始日期">
          </el-date-picker>
          <span>开始日期：</span>
        </li>
        <li>
          <el-date-picker
            v-model="endDate"
            size="mini"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="截至日期">
          </el-date-picker>
          <span>截至日期：</span>
        </li>
      </ul>
        
    </div>
  </div>
</template>
<script>
import request from "@/utils/request.js";
export default {
  name: "ImFqTopInput",
  data() {
    return {
      workbinCode: "",
      mProductNumber: "",
      itemCode: "",
      qualityCode: "",
      barcode: "",
      aoCode:"",
      startDate:"",
      endDate:"",
      pageSize:20,
      pageNumber:1
    };
  },
  methods: {
    // 顶部条件查询
    handleQuery() {
      request.post("/inBillQuery/ParamsByInBillQuery",{
        searchParams: {
          workbinCode: this.workbinCode,
          itemCode: this.itemCode,
          qualityCode: this.qualityCode,
          barcode:this.barcode,
          mProductNumber: this.mProductNumber,
          startDate:this.startDate,
          endDate:this.endDate,
          aoCode:this.aoCode
        },
        pageParameter: {
          rows: this.pageSize,
          page: this.pageNumber,
        },
      }).then((res) => {
        // 将条件查找的数据传给Table
        this.$bus.$emit("ImFqSearchData", res.data.responseBody);
        console.log("入库查询Search", res);
        if(res.data.retCode == 201) {
          this.$Alert({
            title: "失败",
            message: res.data.message,
            type: "error",
          });
        }
      });
    },
  },
  mounted(){
    this.$bus.$on('imFqPageSize',(e)=>{
      this.pageSize = e
      request.post("/inBillQuery/ParamsByInBillQuery",{
        searchParams: {
          workbinCode: this.workbinCode,
          itemCode: this.itemCode,
          qualityCode: this.qualityCode,
          barcode:this.barcode,
          mProductNumber: this.mProductNumber,
          startDate:this.startDate,
          endDate:this.endDate,
          aoCode:this.aoCode
        },
        pageParameter: {
          rows: this.pageSize,
          page: this.pageNumber,
        },
      }).then((res) => {
        // 将条件查找的数据传给Table
        this.$bus.$emit("ImFqSearchData", res.data.responseBody);
        console.log("入库查询Search", res);
      });
    })
    this.$bus.$on('imFqPageNumber',(e)=>{
      this.pageNumber = e
      request.post("/inBillQuery/ParamsByInBillQuery",{
        searchParams: {
          workbinCode: this.workbinCode,
          itemCode: this.itemCode,
          qualityCode: this.qualityCode,
          barcode:this.barcode,
          mProductNumber: this.mProductNumber,
          startDate:this.startDate,
          endDate:this.endDate,
          aoCode:this.aoCode
        },
        pageParameter: {
          rows: this.pageSize,
          page: this.pageNumber,
        },
      }).then((res) => {
        // 将条件查找的数据传给Table
        this.$bus.$emit("ImFqSearchData", res.data.responseBody);
        console.log("入库查询Search", res);
      });
    })
  }
};
</script>
<style scoped>
.im-fq-topInputBox {
  margin-top: 5px;
}
.el-select {
  width: 140px;
}
.el-input {
  width: 140px;
}
.im-fq-topInput {
  overflow: hidden;
  text-align: center;
  border-bottom: 1px dotted rgb(141, 129, 129);
}
.im-fq-topInput ul li {
  float: left;
  width: 23%;
  height: 30px;
  line-height: 30px;
  margin-right: 1%;
  margin-bottom: 5px;
  overflow: hidden;
}
.im-fq-topInput ul li span {
  float: right;
}
.im-fq-topInput ul li div {
  float: right;
}
</style>